<template>
	<view>
		<scroll-view scroll-x :class="[bgColor]" class="nav">
			<view class="cu-item" :class="index==TabCur?'text-selet':''" v-for="(item,index) in datas" :key="index" @tap="tabSelect" :data-id="index">
				<text v-if="item.cuIcon!=null" :class="['cuIcon-' + item.cuIcon]" class="margin-left-sm"></text> 
				{{item.name}}
				<view class="text-selet-cur bg-orange" v-if="index==TabCur"></view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				TabCur: 0,
				scrollLeft: 0
			};
		},
		name: 'cu-nav',
		computed: {
			style() {
				var style=""
				return style
			}
		},
		props: {
			datas:Array,
			bgColor: {
				type: String,
				default: 'bg-white'
			}
		},
		methods: {
			onClick() {
				this.$emit('onclick', true);
			},
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
				this.$emit('onchange', this.TabCur);
			}
		}
	}
</script>

<style scoped>
	.cu-item{
		font-size:32upx;
		font-family:PingFang;
		font-weight:500;
		color:rgba(70,70,83,1);
		
	}
	.text-selet{
		font-size:36upx;
		font-family:PingFang;
		font-weight:bold;
		color:rgba(3,2,20,1);
		line-height:36upx;
	}
	.text-selet-cur{
		width:36upx;
		height:12upx;
		border-radius:6upx;
		margin-left: auto;
		margin-right: auto;
		margin-top: 10upx;
	}
</style>
